package com.dkt.blogboot.util;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzConfig {

    @Bean
    public JobDetail blogScanJobDetail() {
        return JobBuilder.newJob(BlogScanJob.class)
                .withIdentity("BlogScanJob")
                .storeDurably()
                .build();
    }

    @Bean
    public Trigger blogScanTrigger() {
        return TriggerBuilder.newTrigger()
                .forJob(blogScanJobDetail())
                .withIdentity("BlogScanTrigger")
                .withSchedule(CronScheduleBuilder.cronSchedule("0/10 * * * * ?"))
                .build();
    }
}